package singleton;

/**
 * @author shenhan
 * @create 2020/3/18 22:26
 * @description 懒汉式 (线程安全)
 */
public class Singleton4 {
    private Singleton4() {

    }

    private static Singleton4 instance;

    public static synchronized Singleton4 getInstance() {
        if (instance == null) {
            instance = new Singleton4();
        }
        return instance;
    }
}
